import React from 'react'
import "./Toiteam.css"
export default function Toiteam(props) {
  let { iteam, index, deltitle, changeval, gettype } = props

  // let changevalue = (id) => {

  // return ()=>{
  //   updatatitle(id)
  //   gettype()
  // }

  // }
  // // 删除
  // let del = (id)=>{
  //   return ()=>{
  //     if(window.confirm("确认不吃吗?")){
  //       deltitle(id)
  //     }    
  //   }
  // }
  // 删除
  let del = (id) => {
    return () => {
      deltitle(id)
    }
  }
  // 勾选多选框
  let changevalue = (id) => {
    return (e) => {
      changeval(id,e.target.checked)

    }

  }

  return (
    <li key={iteam.id}>
      <label>
        <input type="checkbox" checked={iteam.type} onChange={changevalue(iteam.id)} />
        <span>{iteam.title}</span>
      </label>
      <button className="btn btn-danger" onClick={del(iteam.id)} >删除</button>
    </li>
  )
}
